Hello, I am trying to figure out how to return a pargraph and table from a STATA program. There is already an open putdocx file avaiable for it to go into. Ideally, it can just append it to the open putdocx file as if all the code were 'repeated' multiple times in the stata do file.... which is what I am trying to avoid having to do. Some possibilities... (1) can you return a table? (2) can I just have it add it to the open docx document without returning anything? (3) do I have to pass it the open docx somehow? (4) Or what is a better approach? Thanks in advance!
As an aside, I also can't figure out how to pass this in as the `myif' in the args of the program to ensure it eventually uses (if len_start1[`m'] != 10) as it currently keeps dropping the `m' part entirely and I'm left with (if len_start1[] != 10) ...which fails.
Code:
capture program drop fulltable program fulltable, rclass args num myvar myheader myif putdocx paragraph, halign(left) putdocx text ("`myheader'"), bold underline font(Calibri,12) linebreak(2) putdocx table t`num'=(`rows',`cols'), headerrow(1) layout(autofitcontents) * A BUNCH OF CODE WHICH ADDS ROW TO TABLE * return local row `row' end
As an aside, I also can't figure out how to pass this in as the `myif' in the args of the program to ensure it eventually uses (if len_start1[`m'] != 10) as it currently keeps dropping the `m' part entirely and I'm left with (if len_start1[] != 10) ...which fails.
Code:
local tif2 = `" "if len_start1[\`m\'] != 10" "'
Comment